<%@ page import="static com.test.ws.s1.utils.Res.fileUrl" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>修改旅游路线</title>
    <!-- 复用原有样式 -->
    <style>
        /* 基础表格样式 */
        table {
            width: 100%;
            border-collapse: collapse;
            margin: 20px 0;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }
        th, td {
            border: 1px solid #ddd;
            padding: 12px;
            text-align: center;
        }
        th {
            background-color: #4CAF50;
            color: white;
            font-weight: bold;
        }
        tr:nth-child(even) {
            background-color: #f2f2f2;
        }
        tr:hover {
            background-color: #e9e9e9;
        }

        /* 头像样式 */
        .avatar-circle {
            border-radius: 50%;
            width: 50px;
            height: 50px;
            object-fit: cover;
            border: 2px solid #ddd;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            transition: transform 0.3s;
        }
        .avatar-circle:hover {
            transform: scale(1.1);
        }

        /* 搜索栏样式 */
        .search-bar {
            background: #f8f9fa;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            margin: 20px 0;
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            align-items: center;
        }
        .search-input {
            flex: 1;
            min-width: 200px;
            border: 2px solid #dee2e6;
            border-radius: 25px;
            padding: 10px 20px;
            font-size: 14px;
            transition: all 0.3s;
        }
        .search-input:focus {
            border-color: #4CAF50;
            box-shadow: 0 0 0 0.2rem rgba(76, 175, 80, 0.25);
        }
        .search-btn {
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 25px;
            padding: 10px 25px;
            cursor: pointer;
            font-weight: 500;
            transition: all 0.3s;
        }
        .search-btn:hover {
            background-color: #45a049;
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }
        .reset-btn {
            background-color: #f44336;
            color: white;
            border: none;
            border-radius: 25px;
            padding: 10px 25px;
            cursor: pointer;
            font-weight: 500;
            transition: all 0.3s;
            text-decoration: none;
            display: inline-block;
        }
        .reset-btn:hover {
            background-color: #d32f2f;
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }

        /* 操作按钮 */
        .action-btn {
            padding: 6px 12px;
            margin: 0 5px;
            border-radius: 4px;
            text-decoration: none;
            color: white;
            font-size: 14px;
            transition: all 0.3s;
        }
        .edit-btn {
            background-color: #2196F3;
        }
        .edit-btn:hover {
            background-color: #0b7dda;
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        }
        .delete-btn {
            background-color: #f44336;
        }
        .delete-btn:hover {
            background-color: #d32f2f;
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        }
        .add-btn {
            display: inline-block;
            background-color: #4CAF50;
            color: white;
            padding: 10px 20px;
            border-radius: 4px;
            text-decoration: none;
            margin-top: 20px;
            transition: all 0.3s;
        }
        .add-btn:hover {
            background-color: #45a049;
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }

        /* 分页样式 */
        .pagination-container {
            margin: 30px 0;
            display: flex;
            justify-content: center;
        }
        .pagination {
            display: flex;
            gap: 5px;
            list-style: none;
            padding: 0;
        }
        .page-item {
            margin: 0;
        }
        .page-link {
            padding: 8px 16px;
            border: 1px solid #ddd;
            border-radius: 4px;
            color: #4CAF50;
            text-decoration: none;
            transition: all 0.3s;
        }
        .page-item.active .page-link {
            background: #4CAF50;
            color: white;
            border-color: #4CAF50;
        }
        .page-link:hover:not(.active) {
            background: #f1f1f1;
        }
        .page-item.disabled .page-link {
            color: #ccc;
            pointer-events: none;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            table, thead, tbody, th, td, tr {
                display: block;
            }
            thead tr {
                position: absolute;
                top: -9999px;
                left: -9999px;
            }
            tr {
                margin-bottom: 15px;
                border: 1px solid #ddd;
                border-radius: 5px;
            }
            td {
                border: none;
                border-bottom: 1px solid #eee;
                position: relative;
                padding-left: 50%;
                text-align: right;
            }
            td:before {
                content: attr(data-label);
                position: absolute;
                left: 10px;
                width: 45%;
                padding-right: 10px;
                font-weight: bold;
                text-align: left;
            }
            .search-bar {
                flex-direction: column;
                align-items: stretch;
            }
            .search-input, .search-btn, .reset-btn {
                width: 100%;
                margin-bottom: 10px;
            }
        }


        /*分页*/
        .pagination {
            display: flex;
            gap: 8px;
            padding: 15px 0;
        }

        .pagination a {
            padding: 8px 16px;
            border: 1px solid #4CAF50;
            border-radius: 4px;
            text-decoration: none;
            color: #4CAF50;
            transition: all 0.3s;
        }

        .pagination a.current {
            background: #4CAF50;
            color: white;
            border-color: #4CAF50;
        }

        .pagination a:hover:not(.current) {
            background: #f1f1f1;
        }

        /*!* 表单布局 *!*/
        /*.form-row {*/
        /*    display: flex;*/
        /*    gap: 20px;*/
        /*    margin-bottom: 15px;*/
        /*}*/

        /*.form-group {*/
        /*    flex: 1;*/
        /*}*/

        /*.form-footer {*/
        /*    text-align: right;*/
        /*    margin-top: 20px;*/
        /*}*/


        /* 网格布局调整为5列 */
        .form-row {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 12px;
            margin-bottom: 15px;
        }

        /* 下拉菜单增强样式 */
        select.form-input {
            appearance: none;
            background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%234CAF50"><path d="M7 10l5 5 5-5z"/></svg>')
            no-repeat right 12px center/12px;
            padding-right: 32px;
        }

        /* 响应式调整 */
        @media (max-width: 1200px) {
            .form-row {
                grid-template-columns: repeat(3, 1fr);
            }
        }

        @media (max-width: 992px) {
            .form-row {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        @media (max-width: 768px) {
            .form-row {
                grid-template-columns: 1fr;
            }
            select.form-input {
                background-size: 10px;
                padding-right: 28px;
            }
        }

        /*111*/
        /* 修改搜索栏容器圆角 */
        .search-bar {
            border-radius: 20px;  /* 原为8px */
            overflow: hidden;     /* 新增隐藏内部元素溢出 */
        }

        /* 调整搜索按钮圆角 */
        .btn-search,
        .btn-reset {
            border-radius: 15px;  /* 原为25px */
        }

        /* 调整输入框圆角 */
        .form-input {
            border-radius: 12px;  /* 原为25px */
            padding: 12px 20px;   /* 增大内边距 */
        }

        /* 适配移动端 */
        @media (max-width: 768px) {
            .search-bar {
                border-radius: 15px;
            }

            .form-input {
                border-radius: 8px;
            }
        }


        /* 在现有样式基础上修改以下内容 */

        .btn-search,
        .btn-reset {
            /* 基础样式 */
            position: relative;
            overflow: hidden;
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            font-weight: 600;
            letter-spacing: 0.8px;
            padding: 14px 32px;
            border: none;

            /* 新增样式 */
            background-image: linear-gradient(
                    135deg,
                    rgba(255,255,255,0.15) 0%,
                    transparent 50%,
                    rgba(0,0,0,0.05) 100%
            );
            box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1),
            0 2px 4px -1px rgba(0,0,0,0.06);
        }


    </style>
</head>
<body>
<h2 style="color: #4CAF50; text-align: center; margin-top: 20px;">修改旅游路线</h2>

<!-- 编辑表单 -->
<div class="search-bar" style="max-width: 1200px; margin: 20px auto;">
    <form action="${pageContext.request.contextPath}/updateRoute" method="post" enctype="multipart/form-data">
        <input type="hidden" name="route_id" value="${routess.route_id}">

        <!-- 第一行 -->
        <div class="form-row">
            <div class="form-group">
                <label>路线名称：</label>
                <input type="text" name="route_name" class="form-input"
                       value="${routess.route_name}" required>
            </div>
            <div class="form-group">
                <label>出发地：</label>
                <input type="text" name="route_star" class="form-input"
                       value="${routess.route_star}" required>
            </div>
            <div class="form-group">
                <label>目的地：</label>
                <input type="text" name="route_end" class="form-input"
                       value="${routess.route_end}" required>
            </div>
            <div class="form-group">
                <label>价格：</label>
                <input type="number" name="route_price" class="form-input"
                       value="${routess.route_price}" min="0" step="0.01" required>
            </div>
            <div class="form-group">
                <label>行程天数：</label>
                <input type="number" name="route_days" class="form-input"
                       value="${routess.route_days}" min="1" required>
            </div>
        </div>

        <!-- 第二行 -->
        <div class="form-row">
            <div class="form-group">
                <label>热点路线：</label>
                <select name="route_on" class="form-input" required>
                    <option value="1" ${routess.route_on == 1 ? 'selected' : ''}>是</option>
                    <option value="0" ${routess.route_on == 0 ? 'selected' : ''}>否</option>
                </select>
            </div>
            <div class="form-group">
                <label>分类栏目：</label>
                <select name="cla_id" class="form-input" required>
                    <c:forEach items="${classIfs}" var="c">
                        <option value="${c.classif_id}"
                            ${routess.cla_id == c.classif_id ? 'selected' : ''}>
                                ${c.classif_name}
                        </option>
                    </c:forEach>
                </select>
            </div>
            <div class="form-group">
                <label>供应商：</label>
                <select name="gy_id" class="form-input" required>
                    <c:forEach items="${suppliers}" var="s">
                        <option value="${s.supplier_id}"
                            ${routess.gy_id == s.supplier_id ? 'selected' : ''}>
                                ${s.supplier_name}
                        </option>
                    </c:forEach>
                </select>
            </div>
            <div class="form-group">
                <label>线路图片：</label>
                <input type="file" name="image" class="form-input"
                       accept="image/*" onchange="previewImage(this)">
                <img id="preview" src="<%=fileUrl%>${routess.route_img}"
                     style="max-width: 100px; margin-top: 10px;">
            </div>
        </div>

        <!-- 第三行（全宽） -->
        <div class="form-row">
            <div class="form-group" style="grid-column: span 5;">
                <label>线路介绍：</label>
                <textarea name="route_js" class="form-input"
                          style="height: 100px;" required>${routess.route_js}</textarea>
            </div>
        </div>

        <!-- 操作按钮 -->
        <div class="form-footer">
            <button type="submit" class="btn-search">保存修改</button>
            <a href="${pageContext.request.contextPath}/routeCha" class="btn-reset">返回列表</a>
        </div>
    </form>
</div>

<script>
    // 图片预览功能
    function previewImage(input) {
        const preview = document.getElementById('preview');
        if (input.files && input.files[0]) {
            const reader = new FileReader();
            reader.onload = function(e) {
                preview.src = e.target.result;
            }
            reader.readAsDataURL(input.files[0]);
        }
    }
</script>
</body>
</html>
